package com.sanbi.shield.server.common.exceptions;

import com.sanbi.shield.server.facade.enums.ShieldExceptionMsgEnum;
import lombok.Getter;

import java.text.MessageFormat;

/**
 * 业务异常
 *
 * @author XiaoQingqing
 * @since 2024/07/27
 */
@Getter
public class BizException extends RuntimeException {
    /**
     * 异常信息
     */
    private final ShieldExceptionMsgEnum massageEnum;

    /**
     * 构造器
     *
     * @param massageEnum 异常信息枚举
     * @param args        参数数组
     */
    public BizException(ShieldExceptionMsgEnum massageEnum, Object... args){
        super(MessageFormat.format(massageEnum.getWarnTemplate(), args));
        this.massageEnum = massageEnum;
    }

}
